package yanivosher.aiproject;

import java.util.LinkedList;

public class HeuristicVertex implements Comparable<HeuristicVertex>{

	int HeuristicCost = Integer.MAX_VALUE;
	public Vertex vertex = null;
	
	public HeuristicVertex(Vertex vertex) {
		this.vertex = vertex;
	}
	
	public void calculateHeuristicValue(Vertex destination) {
		LinkedList<Vertex> trip = DijkstraAlgorithm.getShortestPath(Environment.getInstance().graph,this.vertex,destination);
		this.HeuristicCost = Environment.getInstance().graph.getPathCost(trip)*2;
		System.out.println("vertext "+vertex.getId() + "HeuristicCost = " + this.HeuristicCost);
	}

	@Override
	public int compareTo(HeuristicVertex o) {
		if (((HeuristicVertex)o).HeuristicCost > this.HeuristicCost)
			return 1;
		else if(((HeuristicVertex)o).HeuristicCost > this.HeuristicCost)
			return -1;
		else 
			return 0;
	}
}
